package com.cade.agriculturemall.view.classify.goodsdetail.ServiceAssuranceDialog;


import android.support.v7.widget.RecyclerView;
import android.view.ViewGroup;
import android.widget.TextView;

import com.cade.agriculturemall.R;
import com.cade.agriculturemall.base.BaseAdapter;
import com.cade.agriculturemall.base.BaseViewHolder;
import com.cade.agriculturemall.model.ServiceAssuranceEntity;
import com.cade.agriculturemall.utils.ConverUtil;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by Lobby on 2017/12/4.
 */

public class ServiceAssuranceAdapter extends BaseAdapter {

    private List<Integer> arrayList=new ArrayList<>();

    @Override
    public void onBindViewHolderWrapper(BaseViewHolder holder, int position) {
        TextView mTvTitle = holder.findViewById(R.id.service_assurance_item_tv_title);
        TextView mTvContent = holder.findViewById(R.id.service_assurance_item_tv_content);
        ServiceAssuranceEntity sAEntity;
        sAEntity = ConverUtil.toSAContent(arrayList.get(position));
        if (sAEntity != null) {
            mTvTitle.setText(sAEntity.getTitle());
            mTvContent.setText(sAEntity.getContent());
        }
        else{
            mTvContent.setText("kongshuju");
        }
    }

    @Override
    public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        return new BaseViewHolder(parent, R.layout.serviceassurance_item);
    }



    @Override
    public int getItemCount() {
        return arrayList.size();
    }

    public void setSAList(List<Integer> list) {
        arrayList.clear();
        arrayList.addAll(list);
        notifyDataSetChanged();
    }
}
